﻿<Page x:Class="ListSwapDemo.Views.ExampleView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase" 
      DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=ExampleViewModel}"
      KeepAlive="True"   
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="525"
	Title="ExampleView">

    <Page.Resources>

        <CollectionViewSource Source="{Binding List1}" x:Key="List1">
            <CollectionViewSource.SortDescriptions>
                <scm:SortDescription PropertyName="SortOrder"/>
            </CollectionViewSource.SortDescriptions>
        </CollectionViewSource>

        <CollectionViewSource Source="{Binding List2}" x:Key="List2">
            <CollectionViewSource.SortDescriptions>
                <scm:SortDescription PropertyName="SortOrder"/>
            </CollectionViewSource.SortDescriptions>
        </CollectionViewSource>

    </Page.Resources>
    
    <!-- User Profiles -->
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <!-- Headline -->
        <Grid >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <TextBlock Style="{StaticResource WinTextGroupHeaderStyle}"
                           Margin="{StaticResource WinVerticalLargeOverhang}"
                           Text="List 1"/>

            <Button Grid.Column="1"
                        Style="{StaticResource WinButtonStyle}"
                        Margin="{StaticResource WinVerticalLargeOverhang}"
                        Command="{Binding CopyAllItemsCommand}"
                        >
                <Button.Content>
                    <Image 
                        Source="/Images/ff.png" 
                        Stretch="None"/>
                </Button.Content>
            </Button>
        </Grid>

        <!-- All Users -->
        <ListBox Grid.Column="0" Grid.Row="1"
                     Style="{StaticResource WinChromeListBox}"
                     ItemContainerStyle="{StaticResource ListBoxContainerStyle}"
                     SelectedItem="{Binding CurrentItem1}"
                     ItemsSource="{Binding Source={StaticResource List1}}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" 
                                   Style="{StaticResource WinTextNormalStyle}" 
                                   Margin="6"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <!-- Headline -->
        <TextBlock Text="List 2" 
                           Grid.Column="1"
                           Margin="{StaticResource WinVerticalLargeOverhang}"
                           Style="{StaticResource WinTextGroupHeaderStyle}"/>

        <!-- Enabled Users -->
        <ListBox Grid.Column="1" Grid.Row="1"
                     Style="{StaticResource WinChromeListBox}"
                     ItemContainerStyle="{StaticResource ListBoxContainerStyle}"
                     SelectedItem="{Binding CurrentItem2}"
                     ItemsSource="{Binding Source={StaticResource List2}}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" 
                                   Style="{StaticResource WinTextNormalStyle}" 
                                   Margin="6"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</Page>
